<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script lang="javascript" src="dist/xlsx.full.min.js"></script>
	<script lang="javascript" src="scripts/jquery.table2excel.js"></script>

	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen">
	<link rel="stylesheet" href="./layui/css/layui.css" type="text/css" media="all">
	<script src="./layui/layui.js" charset="utf-8" type="text/javascript"></script>

	</link>

	<title>信息管理系统</title>
	<script type="text/javascript">
		var oStorage = window.localStorage
		$(document).ready(function () {
			readTime()
			if (oStorage.getItem("text") == undefined) {
				document.getElementById("text").innerHTML = ""
			} else {
				document.getElementById("text").innerHTML = oStorage.getItem("text")
			}

			setSelectOption(document.getElementById("fyHx"), oStorage.getItem("type"))
			setSelectOption(document.getElementById("fyStatus"), oStorage.getItem("area1"))
			setSelectOption(document.getElementById("fyStatus2"), oStorage.getItem("area2"))
			document.getElementById("fyZldz").value = oStorage.getItem("search")


			init()
		})















		function setSelectOption(objSelect, targetValue) {
			if (objSelect) {
				var options = objSelect.options;
				if (options) {
					var len = options.length;
					for (var i = 0; i < len; i++) {
						if (options[i].text == targetValue) {
							options[i].defaultSelected = true;
							options[i].selected = true;
							return true;
						}
					}
				} /*else {
alert('missing element(s)!');
}*/
			} /*else {
alert('missing element(s)!');
}*/
		}

		function init() {
			importJSON()
			/*setTimeout(function () {
				search()

			}, 299)*/



		}
		importJSON = function () {

			(function () {

				$.ajax({
					url: "info.json",//向本地的json文件发送请求
					type: "GET",
					dataType: "json",
					success: function (data) {

						var i;

						document.getElementById("box").innerHTML = `      <tbody><tr>

					
		<th>文件</th>
		<th>时间</th>
		<th>文件类型</th>
		<th>一级行业</th>
		<th>二级行业</th>
		<th>关键字</th>
		<th>操作</th>
		
		
	</tr>
	</tbody>
	`
						console.log(data)
						var html = document.getElementById("box").innerHTML;

						for (i = 0; i < data.length; i++) { //用for循环遍历数组将数据存入html变量中

							html += `<tr>
					<td class="haha">${data[i].name}</td>
					<td>${data[i].time}</td>
					<td>${data[i].type}</td>
					<td>${data[i].area1}</td>
					<td>${data[i].area2}</td>
					<td>${data[i].keyword}</td>
					<td  class="editfile"  onclick="edit(${i})"><a >编辑</a></td>
					</tr>`;
						}
						document.getElementById("box").innerHTML = html;
						var height = oStorage.getItem("Ltop");
						if (height) {     //如果有高度就说明以前存储到。获取到给滚动条

							document.documentElement.scrollTop = height;
							window.scrollTo(0, height)

						}




						const { shell } = require('electron');
						$("td.haha").on("click", function (e) {

							var path1 = $(e.target).text();

							shell.openItem(path1);
						})
					},
					error: function () {
						alert('caonima')
					}
				})
			})();
		}
		function search() {


			console.log('caonimaaaa')
			setTimeout(function () {//因为是即时查询，需要用setTimeout进行延迟，让值写入到input内，再读取
				var storeId = document.getElementById('box');//获取table的id标识
				var selectedAttr1 = document.getElementById("fyXq")
				var selectedAttr2 = document.getElementById("fyHx")
				var selectedAttr3 = document.getElementById("fyStatus")
				var selectedAttr4 = document.getElementById("fyStatus2")
				var time = selectedAttr1.options[selectedAttr1.selectedIndex].text
				var type = selectedAttr2.options[selectedAttr2.selectedIndex].text
				var area1 = selectedAttr3.options[selectedAttr3.selectedIndex].text
				var area2 = selectedAttr4.options[selectedAttr4.selectedIndex].text
				//alert($("#fyXq").find("option:selected").val().text)
				var rowsLength = storeId.rows.length;//表格总共有多少行
				var key = document.getElementById("fyZldz").value;//获取输入框的值
				var searchCol = 0;//要搜索的哪一列，这里是第一列，从0开始数起
				for (var i = 1; i < rowsLength; i++) {//按表的行数进行循环，本例第一行是标题，所以i=1，从第二行开始筛选（从0数起）
					var searchName = storeId.rows[i].cells[searchCol].innerHTML;//取得table行，列的值
					var searchTime = storeId.rows[i].cells[1].innerHTML;

					var searchType = storeId.rows[i].cells[2].innerHTML;
					var searchArea1 = storeId.rows[i].cells[3].innerHTML;
					var searchArea2 = storeId.rows[i].cells[4].innerHTML;
					var searchKeyword = storeId.rows[i].cells[5].innerHTML;
					if (time == "--请选择--" && type == "--请选择--" && area1 == "--请选择--" && area2 == "--请选择--") {
						if (searchName.match(key) || searchKeyword.match(key)) {//用match函数进行筛选，如果input的值，即变量 key的值为空，返回的是ture，
							storeId.rows[i].style.display = '';//显示行操作，
							console.log("ca?")

						} else {
							storeId.rows[i].style.display = 'none';//隐藏行操作

						}
					}
					if (time != "--请选择--" && type == "--请选择--" && area1 == "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type != "--请选择--" && area1 == "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchType == type) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type == "--请选择--" && area1 != "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchArea1 == area1) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}

					if (time == "--请选择--" && type == "--请选择--" && area1 == "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type != "--请选择--" && area1 == "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time && searchType == type) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type == "--请选择--" && area1 != "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time && searchArea1.match == area1) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type == "--请选择--" && area1 == "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type != "--请选择--" && area1 != "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchType == type && searchArea1 == area1) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type != "--请选择--" && area1 == "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchType == type && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type == "--请选择--" && area1 != "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchArea1 == area1 && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type != "--请选择--" && area1 != "--请选择--" && area2 == "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time && searchType == type && searchArea1 == area1) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type != "--请选择--" && area1 == "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && earchTime == time && searchType == type && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time == "--请选择--" && type != "--请选择--" && area1 != "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchType == type && searchArea1 == area1 && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
					if (time != "--请选择--" && type != "--请选择--" && area1 != "--请选择--" && area2 != "--请选择--") {
						if ((searchName.match(key) || searchKeyword.match(key)) && searchTime == time && searchType == type && searchArea1 == area1 && searchArea2 == area2) {
							storeId.rows[i].style.display = '';

						} else {
							storeId.rows[i].style.display = 'none';

						}
					}
				}
				document.getElementById("boxnew").innerHTML = `      <tbody><tr>

			<th>文件</th>
			<th>时间</th>
			<th>文件类型</th>
			<th>一级行业</th>
			<th>二级行业</th>
			<th>关键字</th>
			<th>操作</th>


</tr>
</tbody>
`

				var html = document.getElementById("boxnew").innerHTML
				for (i = 1; i < rowsLength; i++) {
					if (storeId.rows[i].style.display == '') {
						html += `<tr>
					<td class="haha">${storeId.rows[i].cells[0].innerHTML}</td>
					<td>${storeId.rows[i].cells[1].innerHTML}</td>
					<td>${storeId.rows[i].cells[2].innerHTML}</td>
					<td>${storeId.rows[i].cells[3].innerHTML}</td>
					<td>${storeId.rows[i].cells[4].innerHTML}</td>
					<td>${storeId.rows[i].cells[5].innerHTML}</td>
					<td class="editfile"><a >编辑</a></td>
					</tr>`;


					}
					document.getElementById("boxnew").innerHTML = html

				}

			}, 20);//200为延时时间

		}

		function readTime() {
			var fs = require('fs')
			var person = []
			fs.readFile("./resources/app/time.json", function (err, data) {
				if (err) {
					return console.error(err)
				}

				person = JSON.parse(data.toString())
				$("#fyXq").empty()
				var option0 = document.createElement("option");
				document.getElementById("fyXq").appendChild(option0);
				option0.text = "--请选择--"

				for (var i = 0; i < person.length; i++) {
					var option = document.createElement("option");
					document.getElementById("fyXq").appendChild(option);

					option.value = i + 1; //每个option的位置
					option.text = person[i].year;//每个Option的值


				}
				setSelectOption(document.getElementById("fyXq"), oStorage.getItem("time"))

			}
			)




		}
		function createTime(num) {

			var path_1 = require('path')
			var fs = require('fs')
			var person = []
			fs.readFile("./resources/app/time.json", function (err, data) {
				if (err) {
					return console.error(err)
				}
				person = JSON.parse(data.toString())
				var obj = {
					value: person.length + 1,
					year: num

				}
				person.push(obj)
				var content = JSON.stringify(person)
				var file = path_1.join(__dirname, "time.json")
				fs.writeFile(file, content, function (err) {
					if (err) {
						alert(err)
					}

				})


			})


		}
		function delTime() {
			var path_1 = require('path')
			var fs = require('fs')
			var person = []
			fs.readFile("./resources/app/time.json", function (err, data) {
				if (err) {
					return console.error(err)
				}
				person = JSON.parse(data.toString())


				person.splice(person.length - 1, 1)
				var content = JSON.stringify(person)
				var file = path_1.join(__dirname, "time.json")
				fs.writeFile(file, content, function (err) {
					if (err) {
						alert(err)
					}

				});
				setTimeout(function () {
					readTime()

				}, 20)


			})


		}
		var area1 = new Array()
		area1[area1.length] = new Array("1", "农业、林业")
		area1[area1.length] = new Array("2", "水利水电")
		area1[area1.length] = new Array("3", "电力")
		area1[area1.length] = new Array("4", "煤炭")
		area1[area1.length] = new Array("5", "石油天然气")
		area1[area1.length] = new Array("6", "公路")
		area1[area1.length] = new Array("7", "铁路、城市轨道")
		area1[area1.length] = new Array("8", "民航")
		area1[area1.length] = new Array("9", "水运")
		area1[area1.length] = new Array("10", "电子、信息工程")
		area1[area1.length] = new Array("11", "冶金")
		area1[area1.length] = new Array("12", "石化、化工、医药")
		area1[area1.length] = new Array("13", "机核工业械")
		area1[area1.length] = new Array("14", "机械")
		area1[area1.length] = new Array("15", "轻工、纺织")
		area1[area1.length] = new Array("16", "建材")
		area1[area1.length] = new Array("17", "建筑")
		area1[area1.length] = new Array("18", "市政公用工程")
		area1[area1.length] = new Array("19", "生态建设和环境工程")
		area1[area1.length] = new Array("20", "水文地质、工程测量、岩土工程")
		area1[area1.length] = new Array("21", "其他")
		var area2 = new Array()
		area2[area2.length] = new Array("1", "1", "种植业")
		area2[area2.length] = new Array("1", "2", "畜牧业")
		area2[area2.length] = new Array("1", "3", "林业")
		area2[area2.length] = new Array("1", "4", "渔业")
		area2[area2.length] = new Array("1", "5", "副业")
		area2[area2.length] = new Array("2", "6", "防洪工程")
		area2[area2.length] = new Array("2", "7", "农田水利工程")
		area2[area2.length] = new Array("2", "8", "水力发电工程")
		area2[area2.length] = new Array("2", "9", "航道和港口工程")
		area2[area2.length] = new Array("2", "10", "城镇供水和排水工程")
		area2[area2.length] = new Array("2", "11", "水土保持工程和环境水利工程")
		area2[area2.length] = new Array("2", "12", "渔业水利工程")
		area2[area2.length] = new Array("2", "13", "海涂围垦工程")
		area2[area2.length] = new Array("2", "14", "综合利用水利工程")
		area2[area2.length] = new Array("3", "15", "火电")
		area2[area2.length] = new Array("3", "16", "水电")
		area2[area2.length] = new Array("3", "17", "核电")
		area2[area2.length] = new Array("3", "18", "新能源")
		area2[area2.length] = new Array("4", "19", "褐煤")
		area2[area2.length] = new Array("4", "20", "烟煤")
		area2[area2.length] = new Array("4", "21", "无烟煤")
		area2[area2.length] = new Array("4", "22", "半无烟煤")
		area2[area2.length] = new Array("5", "23", "勘探")
		area2[area2.length] = new Array("5", "24", "开发")
		area2[area2.length] = new Array("5", "25", "集输")
		area2[area2.length] = new Array("5", "26", "产品")
		area2[area2.length] = new Array("5", "27", "产品添加剂")
		area2[area2.length] = new Array("6", "28", "高速公路")
		area2[area2.length] = new Array("6", "29", "一级公路")
		area2[area2.length] = new Array("6", "30", "二级公路")
		area2[area2.length] = new Array("6", "31", "三级公路")
		area2[area2.length] = new Array("6", "32", "四级公路")
		area2[area2.length] = new Array("7", "33", "Ⅰ级铁路")
		area2[area2.length] = new Array("7", "34", "Ⅱ级铁路")
		area2[area2.length] = new Array("7", "35", "Ⅲ级铁路")
		area2[area2.length] = new Array("7", "36", "IV级铁路")
		area2[area2.length] = new Array("7", "37", "地铁")
		area2[area2.length] = new Array("7", "38", "轻轨")
		area2[area2.length] = new Array("7", "39", "有轨电车")
		area2[area2.length] = new Array("7", "40", "市郊铁路")
		area2[area2.length] = new Array("7", "41", "单轨交通")
		area2[area2.length] = new Array("7", "42", "自动导轨交通")
		area2[area2.length] = new Array("7", "43", "磁悬浮交通")
		area2[area2.length] = new Array("7", "44", "直线电机轨道交通")
		area2[area2.length] = new Array("8", "45", "公共航空运输")
		area2[area2.length] = new Array("8", "46", "通用航空")
		area2[area2.length] = new Array("9", "47", "沿海运输")
		area2[area2.length] = new Array("9", "48", "近海运输")
		area2[area2.length] = new Array("9", "49", "远洋运输")
		area2[area2.length] = new Array("9", "50", "远洋运输")
		area2[area2.length] = new Array("10", "51", "电子科学与技术")
		area2[area2.length] = new Array("10", "52", "计算机")
		area2[area2.length] = new Array("10", "53", "信息通讯工程")
		area2[area2.length] = new Array("10", "54", "网络空间安全")
		area2[area2.length] = new Array("11", "55", "黑色冶金")
		area2[area2.length] = new Array("11", "56", "有色冶金")
		area2[area2.length] = new Array("12", "57", "石化")
		area2[area2.length] = new Array("12", "58", "基础化工")
		area2[area2.length] = new Array("12", "59", "化学纤维")
		area2[area2.length] = new Array("12", "60", "医药")
		area2[area2.length] = new Array("13", "61", "无")
		area2[area2.length] = new Array("14", "62", "农业机械")
		area2[area2.length] = new Array("14", "63", "重型矿山机械")
		area2[area2.length] = new Array("14", "64", "工程机械")
		area2[area2.length] = new Array("14", "65", "石化通用机械")
		area2[area2.length] = new Array("14", "66", "电工机械")
		area2[area2.length] = new Array("14", "67", "机床")
		area2[area2.length] = new Array("14", "68", "汽车")
		area2[area2.length] = new Array("14", "69", "仪器仪表")
		area2[area2.length] = new Array("14", "70", "基础机械")
		area2[area2.length] = new Array("14", "71", "包装机械")
		area2[area2.length] = new Array("14", "72", "环保机械")
		area2[area2.length] = new Array("14", "73", "其他机械")
		area2[area2.length] = new Array("15", "74", "食品")
		area2[area2.length] = new Array("15", "75", "纺织")
		area2[area2.length] = new Array("15", "76", "家电")
		area2[area2.length] = new Array("15", "77", "造纸")
		area2[area2.length] = new Array("16", "78", "结构材料")
		area2[area2.length] = new Array("16", "79", "装饰材料")
		area2[area2.length] = new Array("17", "80", "居住建筑")
		area2[area2.length] = new Array("17", "81", "公共建筑")
		area2[area2.length] = new Array("17", "82", "工业建筑")
		area2[area2.length] = new Array("17", "83", "农业建筑")
		area2[area2.length] = new Array("18", "84", "城市道路及其设施")
		area2[area2.length] = new Array("18", "85", "城市桥涵及其设施")
		area2[area2.length] = new Array("18", "86", "城市排水设施")
		area2[area2.length] = new Array("18", "87", "城市防洪设施")
		area2[area2.length] = new Array("18", "88", "城市道路照明设施")
		area2[area2.length] = new Array("18", "89", "城市建设公用设施")
		area2[area2.length] = new Array("19", "90", "生态建设")
		area2[area2.length] = new Array("19", "91", "水污染防治")
		area2[area2.length] = new Array("19", "92", "大气污染防治")
		area2[area2.length] = new Array("19", "93", "固体废物处置")
		area2[area2.length] = new Array("19", "94", "噪音防治")
		area2[area2.length] = new Array("19", "95", "污染修复工程")
		area2[area2.length] = new Array("20", "96", "水文地质")
		area2[area2.length] = new Array("20", "97", "工程测量")
		area2[area2.length] = new Array("20", "98", "岩土工程")
		area2[area2.length] = new Array("21", "99", "无")

		function setArea1(ID1, ID2) {
			var area1Obj = document.getElementById("area1")
			var area2Obj = document.getElementById("area2")
			var i;
			var itemArray = null;
			if (area1Obj.value.length > 0) {
				itemArray = new Array();
				for (i = 0; i < area2.length; i++) {
					if (area2[i][0] == area1Obj.value) {
						itemArray[itemArray.length] = new
							Array(area2[i][1], area2[i][2]);
					}
				}
			}
			for (i = area2Obj.options.length; i >= 0; i--) {
				area2Obj.options[i] = null;
			}
			area2Obj.options[0] = new Option("--请选择--");
			area2Obj.options[0].value = "";

			if (itemArray != null) {
				for (i = 0; i < itemArray.length; i++) {
					area2Obj.options[i + 1] = new
						Option(itemArray[i][1]);
					if (itemArray[i][0] != null) {
						area2Obj.options[i].value = itemArray[i][0];
					}
				}
			}
		}



		function edit(i) {
			var top = document.documentElement.scrollTop;    //document.body是获取的body滚动高度，document.documentElement是根节点html的     

			oStorage.setItem("Ltop", top);
			var content = document.getElementById("text").innerHTML
			oStorage.setItem("text", content)
			//alert(document.getElementById("fyXq").options[document.getElementById("fyXq").selectedIndex].text)
			oStorage.setItem("time", document.getElementById("fyXq").options[document.getElementById("fyXq").selectedIndex].text)
			oStorage.setItem("type", document.getElementById("fyHx").options[document.getElementById("fyHx").selectedIndex].text)
			oStorage.setItem("area1", document.getElementById("fyStatus").options[document.getElementById("fyStatus").selectedIndex].text)
			oStorage.setItem("area2", document.getElementById("fyStatus2").options[document.getElementById("fyStatus2").selectedIndex].text)
			//alert(document.getElementById("fyZldz").value)
			oStorage.setItem("search", document.getElementById("fyZldz").value)



			var storeID = document.getElementById('box')
			var length = document.getElementById('box').rows.item(0).cells.length
			var str = []
			for (var n = 0; n < length - 1; n++) {
				var text = storeID.rows[i + 1].cells[n].innerHTML
				str.push(text)
			}

			console.log(str)
			layui.use(['layer'], function () {
				layer.open({
					type: 1,
					offset: 'auto',
					area: ['50%', '50%'],
					btn: ['确定'],
					yes: function (index, layero) {
						//do something
						var data = []
						var name = document.getElementById("name").value
						var time = document.getElementById("time").options[document.getElementById("time").selectedIndex].text
						if (time == "--请选择--") time = ""
						var type = document.getElementById("type").options[document.getElementById("type").selectedIndex].text
						if (type == "--请选择--") type = ""

						var area1 = document.getElementById("area1").options[document.getElementById("area1").selectedIndex].text
						if (area1 == "--请选择--") area1 = ""

						var area2 = document.getElementById("area2").options[document.getElementById("area2").selectedIndex].text
						if (area2 == "--请选择--") area2 = ""
						var keyword = document.getElementById("keyword").value

						data = [name, time, type, area1, area2, keyword]
						var a = require('./click.js')
						a.editJSON(data)
						alert("修改成功")
						layer.close(index); //如果设定了yes回调，需进行手工关闭
						for (var n = 0; n < length - 1; n++) {
							storeID.rows[i + 1].cells[n].innerHTML=data[n]
							
						}
					},
					success: function (layero, index) {
						const fs = require('fs')
						var person = []
						fs.readFile("./resources/app/time.json", function (err, data) {
							if (err) {
								return console.error(err)
							}

							person = JSON.parse(data.toString())
							$("#time").empty()
							var option0 = document.createElement("option");
							document.getElementById("time").appendChild(option0);
							option0.text = "--请选择--"

							for (var i = 0; i < person.length; i++) {
								var option = document.createElement("option");
								document.getElementById("time").appendChild(option);

								option.value = i + 1; //每个option的位置
								option.text = person[i].year;//每个Option的值


							}
						
							setSelectOption(document.getElementById("time"), str[1])



						}
						)


						$("#name").val(str[0])


						setSelectOption(document.getElementById("type"), str[2])
						setSelectOption(document.getElementById("area1"), str[3])
						setArea('area1', 'area2')
						setSelectOption(document.getElementById("area2"), str[4])
						$("#keyword").val(str[5])
					},


					content: `<label>名称</label> <input type="text" id="name" disabled="disabled" /><br>
	<label>时间</label>
	<select id="time">
		<option value="">--请选择--</option>
	</select><br>
	<label>文件类型</label>
	<select name="fangyuanEntity.fyHxCode" id="type" class="ui_select01">
		<option value="">--请选择--</option>
		<option value="76">项目建议书</option>
		<option value="10">可行性研究报告</option>
		<option value="14">资金申请报告</option>
		<option value="71">项目申请报告</option>
		<option value="76">初步设计</option>
		<option value="10">实施方案</option>
		<option value="14">规划</option>
		<option value="71">节能报告</option>
		<option value="76">课题研究</option>
		<option value="10">中（终）期验收</option>
		<option value="14">中（终）期评估</option>

	</select><br>
	<label>一级行业</label>
	<select id="area1" class="ui_select01" onchange="setArea1('area1','area2');">
		<option value="">--请选择--</option>
		<option value="1">农业、林业</option>
		<option value="2">水利水电</option>
		<option value="3">电力</option>
		<option value="4">煤炭</option>
		<option value="5">石油天然气</option>
		<option value="6">公路</option>
		<option value="7">铁路、城市轨道</option>
		<option value="8">民航</option>
		<option value="9">水运</option>
		<option value="10">电子、信息工程</option>
		<option value="11">冶金</option>
		<option value="12">石化、化工、医药</option>
		<option value="13">核工业</option>
		<option value="14">机械</option>
		<option value="15">轻工、纺织</option>
		<option value="16">建材</option>
		<option value="17">建筑</option>
		<option value="18">市政公用工程</option>
		<option value="19">生态建设和环境工程</option>
		<option value="20">水文地质、工程测量、岩土工程</option>
		<option value="21">其他</option>


	</select><br>
	
	<label>二级行业</label>
	<select id="area2" class="ui_select01">
		<option value="">--请选择--</option>
	</select><br>
	<label>关键字</label> <input type="text" id="keyword" /><br>

`

				})


			})

			/*弹出框js*/
			/*$(this).fancybox({

				'width': 733,
				'height': 530,
				'type': 'iframe',
				'hideOnOverlayClick': false,
				'showCloseButton': true,
				'href': "edit.html?name=" + data[0] + "&time=" + data[1] + "&type=" + data[2] + "&area1=" + data[3] + "&area2=" + data[4] + "&keyword=" + data[5],
				'onStart': function () {

					window.location.href = "edit.html?name=" + data[0] + "&time=" + data[1] + "&type=" + data[2] + "&area1=" + data[3] + "&area2=" + data[4] + "&keyword=" + data[5]
				},
				'onclosed': function () {
					window.location.href = "house_list.html"
				}


			});*/

		}


		function open4() {

			var a = require('./click.js')
			var data = a.createJSON(a.walk(document.getElementById("text").innerHTML))
			a.insertJSON(data)
			alert("导入后台成功！请点击下方的导入按钮进行查看！")

		}



	</script>
	<style>
		.alt td {
			background: black !important;
		}
	</style>
</head>

<body>

	<div class="ui_content">
		<div class="ui_tb">
			<table class="table" id="boxnew" style="display: none" cellspacing="0" cellpadding="0" width="100%">
				<tr>


					<th>文件</th>
					<th>时间</th>
					<th>文件类型</th>
					<th>一级行业</th>
					<th>二级行业</th>
					<th>关键字</th>
					<th>操作</th>


				</tr>




			</table>
		</div>

	</div>


	</div>

	<input id="select-directory" type="button" value="选择本机文件夹" />
	<input type="button" onclick="open4()" value="导入本机文件到后台" />
	<script>
		require('./choose.js')
	</script>

	<label>当前路径</label>
	<textarea id="text"></textarea>
	<form id="submitForm" name="submitForm">
		<input type="hidden" name="allIDCheck" value="" id="allIDCheck" />
		<input type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName" />
		<div id="container">
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">搜索</div>
						<div id="box_center">
							<input type="button" value="增加时间" onclick="addTime()" />
							<input type="button" value="减少时间" onclick="delTime()" />
							时间
							<select name="fangyuanEntity.fyXqCode" id="fyXq" class="ui_select01">
								<option value="">--请选择--</option>


							</select>
							<script>


								function addTime() {
									var aucNumLast = parseInt($("#fyXq option:last-child").text()) + 1;



									createTime(aucNumLast)
									setTimeout(function () {
										readTime()
									}, 20)

								}


							</script>



							文件类型
							<select name="fangyuanEntity.fyHxCode" id="fyHx" class="ui_select01">
								<option value="">--请选择--</option>
								<option value="76">项目建议书</option>
								<option value="10">可行性研究报告</option>
								<option value="14">资金申请报告</option>
								<option value="71">项目申请报告</option>
								<option value="76">初步设计</option>
								<option value="10">实施方案</option>
								<option value="14">规划</option>
								<option value="71">节能报告</option>
								<option value="76">课题研究</option>
								<option value="10">中（终）期验收</option>
								<option value="14">中（终）期评估</option>

							</select>
							一级行业
							<select name="fangyuanEntity.fyStatus" id="fyStatus" class="ui_select01"
								onchange="setArea('fyStatus','fyStatus2');">
								<option value="">--请选择--</option>
								<option value="1">农业、林业</option>
								<option value="2">水利水电</option>
								<option value="3">电力</option>
								<option value="4">煤炭</option>
								<option value="5">石油天然气</option>
								<option value="6">公路</option>
								<option value="7">铁路、城市轨道</option>
								<option value="8">民航</option>
								<option value="9">水运</option>
								<option value="10">电子、信息工程</option>
								<option value="11">冶金</option>
								<option value="12">石化、化工、医药</option>
								<option value="13">核工业</option>
								<option value="14">机械</option>
								<option value="15">轻工、纺织</option>
								<option value="16">建材</option>
								<option value="17">建筑</option>
								<option value="18">市政公用工程</option>
								<option value="19">生态建设和环境工程</option>
								<option value="20">水文地质、工程测量、岩土工程</option>
								<option value="21">其他</option>


							</select>
							二级行业
							<select id="fyStatus2" class="ui_select01">
								<option value="">--请选择--</option>
							</select>
							<script language="javascript">
								var area1 = new Array()
								area1[area1.length] = new Array("1", "农业、林业")
								area1[area1.length] = new Array("2", "水利水电")
								area1[area1.length] = new Array("3", "电力")
								area1[area1.length] = new Array("4", "煤炭")
								area1[area1.length] = new Array("5", "石油天然气")
								area1[area1.length] = new Array("6", "公路")
								area1[area1.length] = new Array("7", "铁路、城市轨道")
								area1[area1.length] = new Array("8", "民航")
								area1[area1.length] = new Array("9", "水运")
								area1[area1.length] = new Array("10", "电子、信息工程")
								area1[area1.length] = new Array("11", "冶金")
								area1[area1.length] = new Array("12", "石化、化工、医药")
								area1[area1.length] = new Array("13", "机核工业械")
								area1[area1.length] = new Array("14", "机械")
								area1[area1.length] = new Array("15", "轻工、纺织")
								area1[area1.length] = new Array("16", "建材")
								area1[area1.length] = new Array("17", "建筑")
								area1[area1.length] = new Array("18", "市政公用工程")
								area1[area1.length] = new Array("19", "生态建设和环境工程")
								area1[area1.length] = new Array("20", "水文地质、工程测量、岩土工程")
								area1[area1.length] = new Array("21", "其他")
								var area2 = new Array()
								area2[area2.length] = new Array("1", "1", "种植业")
								area2[area2.length] = new Array("1", "2", "畜牧业")
								area2[area2.length] = new Array("1", "3", "林业")
								area2[area2.length] = new Array("1", "4", "渔业")
								area2[area2.length] = new Array("1", "5", "副业")
								area2[area2.length] = new Array("2", "6", "防洪工程")
								area2[area2.length] = new Array("2", "7", "农田水利工程")
								area2[area2.length] = new Array("2", "8", "水力发电工程")
								area2[area2.length] = new Array("2", "9", "航道和港口工程")
								area2[area2.length] = new Array("2", "10", "城镇供水和排水工程")
								area2[area2.length] = new Array("2", "11", "水土保持工程和环境水利工程")
								area2[area2.length] = new Array("2", "12", "渔业水利工程")
								area2[area2.length] = new Array("2", "13", "海涂围垦工程")
								area2[area2.length] = new Array("2", "14", "综合利用水利工程")
								area2[area2.length] = new Array("3", "15", "火电")
								area2[area2.length] = new Array("3", "16", "水电")
								area2[area2.length] = new Array("3", "17", "核电")
								area2[area2.length] = new Array("3", "18", "新能源")
								area2[area2.length] = new Array("4", "19", "褐煤")
								area2[area2.length] = new Array("4", "20", "烟煤")
								area2[area2.length] = new Array("4", "21", "无烟煤")
								area2[area2.length] = new Array("4", "22", "半无烟煤")
								area2[area2.length] = new Array("5", "23", "勘探")
								area2[area2.length] = new Array("5", "24", "开发")
								area2[area2.length] = new Array("5", "25", "集输")
								area2[area2.length] = new Array("5", "26", "产品")
								area2[area2.length] = new Array("5", "27", "产品添加剂")
								area2[area2.length] = new Array("6", "28", "高速公路")
								area2[area2.length] = new Array("6", "29", "一级公路")
								area2[area2.length] = new Array("6", "30", "二级公路")
								area2[area2.length] = new Array("6", "31", "三级公路")
								area2[area2.length] = new Array("6", "32", "四级公路")
								area2[area2.length] = new Array("7", "33", "Ⅰ级铁路")
								area2[area2.length] = new Array("7", "34", "Ⅱ级铁路")
								area2[area2.length] = new Array("7", "35", "Ⅲ级铁路")
								area2[area2.length] = new Array("7", "36", "IV级铁路")
								area2[area2.length] = new Array("7", "37", "地铁")
								area2[area2.length] = new Array("7", "38", "轻轨")
								area2[area2.length] = new Array("7", "39", "有轨电车")
								area2[area2.length] = new Array("7", "40", "市郊铁路")
								area2[area2.length] = new Array("7", "41", "单轨交通")
								area2[area2.length] = new Array("7", "42", "自动导轨交通")
								area2[area2.length] = new Array("7", "43", "磁悬浮交通")
								area2[area2.length] = new Array("7", "44", "直线电机轨道交通")
								area2[area2.length] = new Array("8", "45", "公共航空运输")
								area2[area2.length] = new Array("8", "46", "通用航空")
								area2[area2.length] = new Array("9", "47", "沿海运输")
								area2[area2.length] = new Array("9", "48", "近海运输")
								area2[area2.length] = new Array("9", "49", "远洋运输")
								area2[area2.length] = new Array("9", "50", "远洋运输")
								area2[area2.length] = new Array("10", "51", "电子科学与技术")
								area2[area2.length] = new Array("10", "52", "计算机")
								area2[area2.length] = new Array("10", "53", "信息通讯工程")
								area2[area2.length] = new Array("10", "54", "网络空间安全")
								area2[area2.length] = new Array("11", "55", "黑色冶金")
								area2[area2.length] = new Array("11", "56", "有色冶金")
								area2[area2.length] = new Array("12", "57", "石化")
								area2[area2.length] = new Array("12", "58", "基础化工")
								area2[area2.length] = new Array("12", "59", "化学纤维")
								area2[area2.length] = new Array("12", "60", "医药")
								area2[area2.length] = new Array("13", "61", "无")
								area2[area2.length] = new Array("14", "62", "农业机械")
								area2[area2.length] = new Array("14", "63", "重型矿山机械")
								area2[area2.length] = new Array("14", "64", "工程机械")
								area2[area2.length] = new Array("14", "65", "石化通用机械")
								area2[area2.length] = new Array("14", "66", "电工机械")
								area2[area2.length] = new Array("14", "67", "机床")
								area2[area2.length] = new Array("14", "68", "汽车")
								area2[area2.length] = new Array("14", "69", "仪器仪表")
								area2[area2.length] = new Array("14", "70", "基础机械")
								area2[area2.length] = new Array("14", "71", "包装机械")
								area2[area2.length] = new Array("14", "72", "环保机械")
								area2[area2.length] = new Array("14", "73", "其他机械")
								area2[area2.length] = new Array("15", "74", "食品")
								area2[area2.length] = new Array("15", "75", "纺织")
								area2[area2.length] = new Array("15", "76", "家电")
								area2[area2.length] = new Array("15", "77", "造纸")
								area2[area2.length] = new Array("16", "78", "结构材料")
								area2[area2.length] = new Array("16", "79", "装饰材料")
								area2[area2.length] = new Array("17", "80", "居住建筑")
								area2[area2.length] = new Array("17", "81", "公共建筑")
								area2[area2.length] = new Array("17", "82", "工业建筑")
								area2[area2.length] = new Array("17", "83", "农业建筑")
								area2[area2.length] = new Array("18", "84", "城市道路及其设施")
								area2[area2.length] = new Array("18", "85", "城市桥涵及其设施")
								area2[area2.length] = new Array("18", "86", "城市排水设施")
								area2[area2.length] = new Array("18", "87", "城市防洪设施")
								area2[area2.length] = new Array("18", "88", "城市道路照明设施")
								area2[area2.length] = new Array("18", "89", "城市建设公用设施")
								area2[area2.length] = new Array("19", "90", "生态建设")
								area2[area2.length] = new Array("19", "91", "水污染防治")
								area2[area2.length] = new Array("19", "92", "大气污染防治")
								area2[area2.length] = new Array("19", "93", "固体废物处置")
								area2[area2.length] = new Array("19", "94", "噪音防治")
								area2[area2.length] = new Array("19", "95", "污染修复工程")
								area2[area2.length] = new Array("20", "96", "水文地质")
								area2[area2.length] = new Array("20", "97", "工程测量")
								area2[area2.length] = new Array("20", "98", "岩土工程")
								area2[area2.length] = new Array("21", "99", "无")

								function setArea(ID1, ID2) {
									var area1Obj = document.getElementById("fyStatus")
									var area2Obj = document.getElementById("fyStatus2")
									var i;
									var itemArray = null;
									if (area1Obj.value.length > 0) {
										itemArray = new Array();
										for (i = 0; i < area2.length; i++) {
											if (area2[i][0] == area1Obj.value) {
												itemArray[itemArray.length] = new
													Array(area2[i][1], area2[i][2]);
											}
										}
									}
									for (i = area2Obj.options.length; i >= 0; i--) {
										area2Obj.options[i] = null;
									}
									area2Obj.options[0] = new Option("--请选择--");
									area2Obj.options[0].value = "";

									if (itemArray != null) {
										for (i = 0; i < itemArray.length; i++) {
											area2Obj.options[i + 1] = new
												Option(itemArray[i][1]);
											if (itemArray[i][0] != null) {
												area2Obj.options[i].value = itemArray[i][0];
											}
										}
									}
								}


							</script>

							搜索内容&nbsp;&nbsp;<input type="text" id="fyZldz" name="fangyuanEntity.fyZldz"
								class="ui_input_txt02" />

						</div>
						<div id="box_bottom">
							<input type="button" value="查询" class="ui_input_btn01" onclick="search();" />
							<input type="button" value="导入" class="ui_input_btn01" onclick="init()" />
							<input type="button" value="导出" class="ui_input_btn01" id="exportExcel" />
							<input type="button" value="保存" class="ui_input_btn01" onclick="save()">
							<input id="copy-directory" type="button" class="ui_input_btn01" value="复制" />
							<script>require('./copy.js')</script>

							<script>
								$(function () {
									$("#exportExcel").click(function () {
										$("#boxnew").table2excel({
											exclude: ".noExl",
											name: "Excel Document Name",
											columns: "6",
											filename: "myFileName",
											exclude_img: true,
											exclude_links: true,
											exclude_inputs: true
										});
									});
								});    
							</script>
							<script>

								function save() {
									var a = require("./click.js")
									a.saveToJSON()
								}
								function copy() {

								}

							</script>

							<script>require('./addNewFile.js')
								require('./click.js')

							</script>
							<style>
								.haha {
									cursor: pointer;
								}

								.editfile {
									cursor: default;
								}
							</style>

						</div>
					</div>
				</div>
			</div>
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" id="box" cellspacing="0" cellpadding="0" width="100%">
						<tr>


							<th>文件</th>
							<th>时间</th>
							<th>文件类型</th>
							<th>一级行业</th>
							<th>二级行业</th>
							<th>关键字</th>
							<th>操作</th>



						</tr>




					</table>
				</div>

			</div>
		</div>
	</form>

</body>

</html>